/*     */ package com.finir.finknjig.domain.beans;
/*     */ 
/*     */ import java.io.Serializable;
import java.text.DateFormat;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cascade;

import com.finir.finknjig.domain.Nalog;
import com.finir.finknjig.domain.Preduzece;
import com.finir.finknjig.domain.StavkaNaloga;
/*     */ 
/*     */ @Entity
/*     */ public class NalogBean
/*     */   implements Nalog, Serializable
/*     */ {
/*     */   private static final long serialVersionUID = 1210162674686353992L;
/*     */   private Long id;
/*     */   private Integer brojNaloga;
/*     */   private Date datumNaloga;
/*     */   private Preduzece preduzece;
/*  58 */   private List<StavkaNaloga> stavkeNaloga = new LinkedList<StavkaNaloga>();
/*     */ 
/*     */   @Id
/*     */   @GeneratedValue(strategy=GenerationType.AUTO)
/*     */   public Long getId()
/*     */   {
/*  42 */     return this.id;
/*     */   }
/*     */ 
/*     */   public void setId(Long id)
/*     */   {
/*  51 */     this.id = id;
/*     */   }
/*     */ 
/*     */   @OneToMany(cascade={javax.persistence.CascadeType.ALL}, mappedBy="nalog", targetEntity=StavkaNalogaBean.class)
/*     */   @Cascade({org.hibernate.annotations.CascadeType.ALL, org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
/*     */   public List<StavkaNaloga> getStavkeNaloga()
/*     */   {
/*  64 */     return this.stavkeNaloga;
/*     */   }
/*     */ 
/*     */   public void setStavkeNaloga(List<StavkaNaloga> stavkeNaloga) {
/*  68 */     this.stavkeNaloga = stavkeNaloga;
/*     */   }
/*     */ 
/*     */   @ManyToOne(targetEntity=PreduzeceBean.class)
/*     */   public Preduzece getPreduzece()
/*     */   {
/*  78 */     return this.preduzece;
/*     */   }
/*     */ 
/*     */   public void setPreduzece(Preduzece preduzece)
/*     */   {
/*  87 */     this.preduzece = preduzece;
/*     */   }
/*     */ 
/*     */   public Integer getBrojNaloga()
/*     */   {
/*  96 */     return this.brojNaloga;
/*     */   }
/*     */ 
/*     */   public void setBrojNaloga(Integer brojNaloga)
/*     */   {
/* 105 */     this.brojNaloga = brojNaloga;
/*     */   }
/*     */ 
/*     */   @Temporal(TemporalType.DATE)
/*     */   public Date getDatumNaloga()
/*     */   {
/* 115 */     return this.datumNaloga;
/*     */   }
/*     */ 
/*     */   public void setDatumNaloga(Date datumNaloga)
/*     */   {
/* 124 */     this.datumNaloga = datumNaloga;
/*     */   }
/*     */ 
/*     */   public int hashCode()
/*     */   {
/* 129 */     int hash = 0;
/* 130 */     hash += ((this.id != null) ? this.id.hashCode() : 0);
/* 131 */     return hash;
/*     */   }
/*     */ 
/*     */   public boolean equals(Object object)
/*     */   {
/* 138 */     if (!(object instanceof NalogBean))
/* 139 */       return false;
/*     */ 
/* 141 */     NalogBean other = (NalogBean)object;
/*     */ 
/* 144 */     return ((((this.id != null) || (other.id == null))) && ((
/* 143 */       (this.id == null) || (this.id.equals(other.id)))));
/*     */   }
/*     */ 
/*     */   public String toString()
/*     */   {
/* 152 */     DateFormat d = DateFormat.getDateInstance(2);
/* 153 */     return this.brojNaloga + "          " + d.format(this.datumNaloga);
/*     */   }
/*     */ }


